/*
 * @Author: 溜溜的陈 525767273@qq.com
 * @Date: 2024-12-27 09:40:05
 * @LastEditors: 溜溜的陈 525767273@qq.com
 * @LastEditTime: 2024-12-30 14:14:14
 * @FilePath: \express-serve\config\db.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/**
 * @Author: 溜溜的陈
 * description: 数据库连接和配置 
 * @createTime: 2024-12-27 09:47:43
 */
const mysql = require('mysql')
module.exports = {
    dbConfig(sql, arr, fun) {
        const dbconect = mysql.createConnection({
            host: 'localhost',
            user: 'root',
            password: '123456',
            database: 'dorm'
        })
        dbconect.connect((err) => {
            if (err) {
                console.log(err)
            } else {
                console.log('数据库连接成功')
            }

        })
        dbconect.query(sql, arr, fun)
        dbconect.end();
    }
}

